/*
 * @Description: 
 * @Author: 阳婷
 * @Date: 2019-07-30 10:21:49
 * @LastEditTime: 2021-12-14 10:01:41
 * @LastEditors: 阳婷
 */ 
import router from './router'
import NProgress from 'nprogress' // Progress 进度条
import 'nprogress/nprogress.css' // Progress 进度条样式
// import {
//     getToken
// } from '@/utils/auth' // 验权

router.beforeEach(({
    meta,
    path
}, from, next) => {
    NProgress.start()
    let isLogin = Boolean(sessionStorage.getItem("token_autoSale"))
        //通过token过期重新登陆
    if (!isLogin && path !== '/login') {
        NProgress.done()
        return next({
            path: '/login'
        })
    }
    next()
})

router.afterEach(() => {
    NProgress.done() // 结束Progress
})